package com.example.springboot1.controller;

import com.example.springboot1.service.UserMongoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("mongo")
public class UserMongoController {

    @Autowired
    private UserMongoService userService;

    @GetMapping("/user/{name}")
    public String user(@PathVariable("name")  String name){
        log.info("hello666");

        return userService.getUserStringByName(name);
    }

    @GetMapping("/age")
    public Integer age(){
        log.info("age");
        log.warn("警告信息");
        return userService.getUserByName("kaka").getAge();
    }
}
